HAL CCB function migration ¶
This section provides information about the HAL CCB function migration.
HAL CCB ECC wrap symmetric key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECC_WrapSymmetricKey(CCB_HandleTypeDef *hccb,
const uint32_t *pClearAESKey,
CCB_WrappingKeyTypeDef *pWrappingKey)
|
HAL_CCB_ECC_WrapSymmetricKey(hal_ccb_handle_t *hccb,
const uint32_t *p_in_user_key,
hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
uint32_t *p_out_wrapped_user_key)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
CCB_HandleTypeDef hccb;
CCB_WrappingKeyTypeDef wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECC_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf);
|
hal_ccb_handle_t hccb;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
uint32_t Wrapped_key_Buffer[8];
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECC_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf, Wrapped_key_Buffer);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the function, instead of being included in the wrapping key configuration structure.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECDSA wrap symmetric key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECDSA_WrapSymmetricKey(CCB_HandleTypeDef *hccb,
const uint32_t *pClearAESKey,
CCB_WrappingKeyTypeDef *pWrappingKey)
|
HAL_CCB_ECDSA_WrapSymmetricKey(hal_ccb_handle_t *hccb,
const uint32_t *p_in_user_key,
hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
uint32_t *p_out_wrapped_user_key)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
CCB_HandleTypeDef hccb;
CCB_WrappingKeyTypeDef wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf);
|
hal_ccb_handle_t hccb;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
uint32_t Wrapped_key_Buffer[8];
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf, Wrapped_key_Buffer);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the function, instead of being included in the wrapping key configuration structure.For more details refer to HAL CCB wrapping key type definition.
HAL CCB RSA wrap symmetric key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_RSA_WrapSymmetricKey(CCB_HandleTypeDef *hccb,
const uint32_t *pClearAESKey,
CCB_WrappingKeyTypeDef *pWrappingKey)
|
HAL_CCB_RSA_WrapSymmetricKey(hal_ccb_handle_t *hccb,
const uint32_t *p_in_user_key,
hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
uint32_t *p_out_wrapped_user_key)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
CCB_HandleTypeDef hccb;
CCB_WrappingKeyTypeDef wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_RSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf);
|
hal_ccb_handle_t hccb;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
uint32_t Symetric_AESKey256[8];
uint32_t Wrapped_key_Buffer[8];
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_RSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf, Wrapped_key_Buffer);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the function, instead of being included in the wrapping key configuration structure.For more details refer to HAL CCB wrapping key type definition.
Note
In HAL1, the hardware key and the hardware-software key were managed through the same API.
In HAL2, they are handled by separate, dedicated APIs.
HAL CCB ECC compute scalar multiplication ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECC_ComputeScalarMul(CCB_HandleTypeDef *hccb,
CCB_ECCMulCurveParamTypeDef *pCurveParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECCMulKeyBlobTypeDef *pWrappedPrivateKeyBlob,
CCB_ECCMulPointTypeDef *pInputPoint,
CCB_ECCMulPointTypeDef *pOutputPoint)
|
/* Software Compute Scalar Multiplication */
HAL_CCB_ECC_SW_ComputeScalarMul(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecc_mul_key_blob_t *p_in_wrapped_private_key_blob,
hal_ccb_ecc_point_t *p_in_point,
hal_ccb_ecc_point_t *p_out_point)
/* Hardware Compute Scalar Multiplication */
HAL_CCB_ECC_HW_ComputeScalarMul(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecc_mul_key_blob_t *p_in_wrapped_private_key_blob,
hal_ccb_ecc_point_t *p_in_point,
hal_ccb_ecc_point_t *p_out_point)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software Compute Scalar Multiplication */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_ECCMulPointTypeDef Point_In;
CCB_ECCMulPointTypeDef Point_Out;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECC_ComputeScalarMul(&hccb, &ECCparam, &wrappedKeyConf, &ECCKeyBlob, &Point_In, &Point_Out);
|
/* Software Compute Scalar Multiplication */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_ecc_point_t Point_In;
hal_ccb_ecc_point_t Point_Out;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECC_SW_ComputeScalarMul(&hccb, &ECCparam, &wrappedKeyConf, Wrapped_key_Buffer, &ECCKeyBlob, &Point_In, &Point_Out);
|
/* Hardware Compute Scalar Multiplication */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_ECCMulPointTypeDef Point_In;
CCB_ECCMulPointTypeDef Point_Out;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECC_ComputeScalarMul(&hccb, &ECCparam, &wrappedKeyConf, &ECCKeyBlob, &Point_In, &Point_Out);
|
/* Hardware Compute Scalar Multiplication */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_ecc_point_t Point_In;
hal_ccb_ecc_point_t Point_Out;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
HAL_CCB_ECC_HW_ComputeScalarMul(&hccb, &ECCparam, HAL_CCB_KEY_HW, &ECCKeyBlob, &Point_In, &Point_Out);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software compute scalar multiplication function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware compute scalar multiplication function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECC generate wrap private key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECC_GenerateWrapPrivateKey(CCB_HandleTypeDef *hccb,
CCB_ECCMulCurveParamTypeDef *pCurveParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECCMulKeyBlobTypeDef *pWrappedPrivateKeyBlob)
|
/* Software Generate Wrap Private Key */
HAL_CCB_ECC_SW_GenerateWrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecc_mul_key_blob_t *p_out_wrapped_private_key_blob)
/* Hardware Generate Wrap Private Key */
HAL_CCB_ECC_HW_GenerateWrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecc_mul_key_blob_t *p_out_wrapped_private_key_blob)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software Generate Wrap Private Key */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECC_GenerateWrapPrivateKey(&hccb, &ECCparam, &wrappedKeyConf, &ECCKeyBlob);
|
/* Software Generate Wrap Private Key */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECC_SW_GenerateWrapPrivateKey(&hccb, &ECCparam, &wrappedKeyConf, Wrapped_key_Buffer, &ECCKeyBlob);
|
/* Hardware Generate Wrap Private Key */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECC_GenerateWrapPrivateKey(&hccb, &ECCparam, &wrappedKeyConf, &ECCKeyBlob);
|
/* Hardware Generate Wrap Private Key */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
HAL_CCB_ECC_HW_GenerateWrapPrivateKey(&hccb, &ECCparam, HAL_CCB_KEY_HW, &ECCKeyBlob);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software ECC generate wrap private key function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware ECC generate wrap private key function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECC wrap private key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECC_WrapPrivateKey(CCB_HandleTypeDef *hccb,
CCB_ECCMulCurveParamTypeDef *pCurveParam,
const uint8_t *pClearPrivateKey,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECCMulKeyBlobTypeDef *pWrappedPrivateKeyBlob)
|
/* Software ECC Wrap Private Key */
HAL_CCB_ECC_SW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
const uint8_t *p_in_clear_private_key,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecc_mul_key_blob_t *p_out_wrapped_private_key_blob)
/* Hardware ECC Wrap Private Key */
HAL_CCB_ECC_HW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecc_mul_curve_param_t *p_in_curve_param,
const uint8_t *p_in_clear_private_key,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecc_mul_key_blob_t *p_out_wrapped_private_key_blob)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software ECC Wrap Private Key */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_HandleTypeDef hccb;
uint8_t eccMul192_Sclr_k_P[24];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECC_WrapPrivateKey(&hccb, &ECCparam, eccMul192_Sclr_k_P, &wrappedKeyConf, &ECCKeyBlob);
|
/* Software ECC Wrap Private Key */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_handle_t hccb;
uint8_t eccMul192_Sclr_k_P[24];
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECC_SW_WrapPrivateKey(&hccb, &ECCparam, eccMul192_Sclr_k_P, &wrappedKeyConf, Wrapped_key_Buffer, &ECCKeyBlob);
|
/* Hardware ECC Wrap Private Key */
CCB_ECCMulCurveParamTypeDef ECCparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECCMulKeyBlobTypeDef ECCKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECC_WrapPrivateKey(&hccb, &ECCparam, eccMul192_Sclr_k_P, &wrappedKeyConf, &ECCKeyBlob);
|
/* Hardware ECC Wrap Private Key */
hal_ccb_ecc_mul_curve_param_t ECCparam;
hal_ccb_ecc_mul_key_blob_t ECCKeyBlob;
hal_ccb_handle_t hccb;
uint8_t eccMul192_Sclr_k_P[24];
HAL_CCB_ECC_HW_WrapPrivateKey(&hccb, &ECCparam, eccMul192_Sclr_k_P, HAL_CCB_KEY_HW, &ECCKeyBlob);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software ECC wrap private key function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware ECC wrap private key function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECDSA compute public key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECDSA_ComputePublicKey(CCB_HandleTypeDef *hccb,
CCB_ECDSACurveParamTypeDef *pCurveParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECDSAKeyBlobTypeDef *pWrappedPrivateKeyBlob,
CCB_ECCMulPointTypeDef *pPublicKey)
|
/* Software ECDSA Compute Public Key */
HAL_CCB_ECDSA_SW_ComputePublicKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecdsa_key_blob_t *p_in_wrapped_private_key_blob,
hal_ccb_ecc_point_t *p_out_public_key)
/* Hardware ECDSA Compute Public Key */
HAL_CCB_ECDSA_HW_ComputePublicKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecdsa_key_blob_t *p_in_wrapped_private_key_blob,
hal_ccb_ecc_point_t *p_out_public_key)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software ECDSA Compute Public Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_ECCMulPointTypeDef publickeyOut;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_ComputePublicKey(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob, &publickeyOut);
|
/* Software ECDSA Compute Public Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_ecc_point_t publickeyOut;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_SW_ComputePublicKey(&hccb, &ECDSAparam, &wrappedKeyConf, Wrapped_key_Buffer, &ECDSAKeyBlob, &publickeyOut);
|
/* Hardware ECDSA Compute Public Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_ECCMulPointTypeDef publickeyOut;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECDSA_ComputePublicKey(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob, &publickeyOut);
|
/* Hardware ECDSA Compute Public Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_ecc_point_t publickeyOut;
hal_ccb_handle_t hccb;
HAL_CCB_ECDSA_HW_ComputePublicKey(&hccb, &ECDSAparam, HAL_CCB_KEY_HW, &ECDSAKeyBlob, &publickeyOut);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software compute ECDSA function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware compute ECDSA function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECDSA generate wrap private key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECDSA_GenerateWrapPrivateKey(CCB_HandleTypeDef *hccb,
CCB_ECDSACurveParamTypeDef *pCurveParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECDSAKeyBlobTypeDef *pWrappedPrivateKeyBlob)
|
/* Software ECDSA Generate Wrap Private Key */
HAL_CCB_ECDSA_SW_GenerateWrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecdsa_key_blob_t *p_out_wrapped_private_key_blob)
/* Hardware ECDSA Generate Wrap Private Key */
HAL_CCB_ECDSA_HW_GenerateWrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecdsa_key_blob_t *p_out_wrapped_private_key_blob)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software ECDSA Generate Wrap Private Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_GenerateWrapPrivateKey(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob);
|
/* Software ECDSA Generate Wrap Private Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_SW_GenerateWrapPrivateKey(&hccb, &ECDSAparam, &wrappedKeyConf, Wrapped_key_Buffer, &ECDSAKeyBlob);
|
/* Hardware ECDSA Generate Wrap Private Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECDSA_GenerateWrapPrivateKey(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob);
|
/* Hardware ECDSA Generate Wrap Private Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_handle_t hccb;
HAL_CCB_ECDSA_HW_GenerateWrapPrivateKey(&hccb, &ECDSAparam, HAL_CCB_KEY_HW, &ECDSAKeyBlob);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software ECDSA generate wrap private key function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware ECDSA generate wrap private key function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB ECDSA sign ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECDSA_Sign(CCB_HandleTypeDef *hccb,
CCB_ECDSACurveParamTypeDef *pCurveParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_ECDSAKeyBlobTypeDef *pWrappedPrivateKeyBlob,
const uint8_t *pHash,
CCB_ECDSASignTypeDef *pSignature)
|
/* Software ECDSA Sign */
HAL_CCB_ECDSA_SW_Sign(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecdsa_key_blob_t *p_in_wrapped_private_key_blob,
const uint8_t *p_in_hash,
uint8_t hash_size, hal_ccb_ecdsa_sign_t *p_out_signature)
/* Hardware ECDSA Sign */
HAL_CCB_ECDSA_HW_Sign(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecdsa_key_blob_t *p_in_wrapped_private_key_blob,
const uint8_t *p_in_hash,
uint8_t hash_size, hal_ccb_ecdsa_sign_t *p_out_signature)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software ECDSA Sign */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_ECDSASignTypeDef Signature;
CCB_HandleTypeDef hccb;
uint8_t ECDSAHash_192[24];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_Sign(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob, ECDSAHash_192, &Signature);
|
/* Software ECDSA Sign */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_ecdsa_sign_t Signature;
hal_ccb_handle_t hccb;
uint8_t ECDSAHash_192[24];
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_SW_Sign(&hccb, &ECDSAparam, &wrappedKeyConf, Wrapped_key_Buffer, &ECDSAKeyBlob, ECDSAHash_192, 24, &Signature);
|
/* Hardware ECDSA Sign */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_ECDSASignTypeDef Signature;
CCB_HandleTypeDef hccb;
uint8_t ECDSAHash_192[24];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECDSA_Sign(&hccb, &ECDSAparam, &wrappedKeyConf, &ECDSAKeyBlob, ECDSAHash_192, &Signature);
|
/* Hardware ECDSA Sign */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_handle_t hccb;
hal_ccb_ecdsa_sign_t Signature;
uint8_t ECDSAHash_192[24];
HAL_CCB_ECDSA_HW_Sign(&hccb, &ECDSAparam, HAL_CCB_KEY_HW, &ECDSAKeyBlob, ECDSAHash_192, 24, &Signature);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software ECDSA sign function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware ECDSA sign function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
hash_size: new argument added in HAL2 SW/HW functions to provide the hash length.
HAL CCB ECDSA wrap private key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_ECDSA_WrapPrivateKey(CCB_HandleTypeDef *hccb,
CCB_ECDSACurveParamTypeDef *pCurveParam,
const uint8_t *pClearPrivateKey,
CCB_WrappingKeyTypeDef *pWrappingKey,
const CCB_ECDSAKeyBlobTypeDef *pWrappedPrivateKeyBlob)
|
/* Software ECDSA Wrap Private Key */
HAL_CCB_ECDSA_SW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
const uint8_t *p_in_clear_private_key,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_ecdsa_key_blob_t *p_out_wrapped_private_key_blob)
/* Hardware ECDSA Wrap Private Key */
HAL_CCB_ECDSA_HW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_ecdsa_curve_param_t *p_in_curve_param,
const uint8_t *p_in_clear_private_key,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_ecdsa_key_blob_t *p_out_wrapped_private_key_blob)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software ECDSA Wrap Private Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_HandleTypeDef hccb;
uint8_t ecdsa192_Prvt_keyP[24];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, &wrappedKeyConf, &ECDSAKeyBlob);
|
/* Software ECDSA Wrap Private Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_handle_t hccb;
uint8_t ecdsa192_Prvt_keyP[24];
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_SW_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, &wrappedKeyConf, Wrapped_key_Buffer, &ECDSAKeyBlob);
|
/* Hardware ECDSA Wrap Private Key */
CCB_ECDSACurveParamTypeDef ECDSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_ECDSAKeyBlobTypeDef ECDSAKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_ECDSA_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, &wrappedKeyConf, &ECDSAKeyBlob);
|
/* Hardware ECDSA Wrap Private Key */
hal_ccb_ecdsa_curve_param_t ECDSAparam;
hal_ccb_ecdsa_key_blob_t ECDSAKeyBlob;
hal_ccb_handle_t hccb;
uint8_t ecdsa192_Prvt_keyP[24];
HAL_CCB_ECDSA_HW_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, HAL_CCB_KEY_HW, &ECDSAKeyBlob);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software ECDSA wrap private key function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware ECDSA wrap private key function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB Intrusion Callback ¶
|
HAL1 |
HAL2 |
|---|---|
|
Intrusion callback was introduced in HAL1, and the user can take the required actions like resetting the system. HAL_CCB_IntrusionCallback(CCB_HandleTypeDef *hccb)
|
No more intrusion callback and the processing functions return the required status: ok or error. Upon an error, the user can perform the same actions as before : example resetting the system. |
HAL CCB RSA compute modular exponentiation ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_RSA_ComputeModularExp(CCB_HandleTypeDef *hccb,
CCB_RSAParamTypeDef *pParam,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_RSAKeyBlobTypeDef *pWrappedPrivateKeyBlob,
const uint8_t *pOperand, uint8_t *pModularExp)
|
/* Software RSA Compute Modular Exponentiation */
HAL_CCB_RSA_SW_ComputeModularExp(hal_ccb_handle_t *hccb,
const hal_ccb_rsa_param_t *p_in_param,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_rsa_key_blob_t *p_in_wrapped_private_key_blob,
const uint8_t *p_in_operand, uint8_t *p_out_modular_exp)
/* Hardware RSA Compute Modular Exponentiation */
HAL_CCB_RSA_HW_ComputeModularExp(hal_ccb_handle_t *hccb, const hal_ccb_rsa_param_t *p_in_param,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_rsa_key_blob_t *p_in_wrapped_private_key_blob,
const uint8_t *p_in_operand, uint8_t *p_out_modular_exp)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software RSA Compute Modular Exponentiation */
CCB_RSAParamTypeDef RSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_RSAKeyBlobTypeDef RSAKeyBlob;
CCB_RSAClearKeyTypeDef RSAKey;
CCB_HandleTypeDef hccb;
uint8_t RSA256_expBase[32];
uint8_t RSA_result_256[32];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_RSA_ComputeModularExp(&hccb, &RSAparam, &wrappedKeyConf, &RSAKeyBlob, RSA256_expBase, RSA_result_256);
|
/* Software RSA Compute Modular Exponentiation */
hal_ccb_rsa_param_t RSAparam;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_rsa_key_blob_t RSAKeyBlob;
hal_ccb_rsa_clear_key_t RSAKey;
hal_ccb_handle_t hccb;
uint8_t RSA256_expBase[32];
uint8_t RSA_result_256[32];
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_RSA_SW_ComputeModularExp(&hccb, &RSAparam, &wrappedKeyConf, Wrapped_key_Buffer, &RSAKeyBlob, RSA256_expBase, RSA_result_256);
|
/* Hardware RSA Compute Modular Exponentiation */
CCB_RSAParamTypeDef RSAparam;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_RSAKeyBlobTypeDef RSAKeyBlob;
CCB_HandleTypeDef hccb;
uint8_t RSA256_expBase[32];
uint8_t RSA_result_256[32];
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_RSA_ComputeModularExp(&hccb, &RSAparam, &wrappedKeyConf, &RSAKeyBlob, RSA256_expBase, RSA_result_256);
|
/* Hardware RSA Compute Modular Exponentiation */
hal_ccb_rsa_param_t RSAparam;
hal_ccb_rsa_key_blob_t RSAKeyBlob;
hal_ccb_handle_t hccb;
uint8_t RSA256_expBase[32];
uint8_t RSA_result_256[32];
HAL_CCB_RSA_HW_ComputeModularExp(&hccb, &RSAparam, HAL_CCB_KEY_HW, &RSAKeyBlob, RSA256_expBase, RSA_result_256);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software RSA compute modular exponentiation function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware RSA compute modular exponentiation function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.
HAL CCB RSA wrap private key ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_CCB_RSA_WrapPrivateKey(CCB_HandleTypeDef *hccb,
CCB_RSAParamTypeDef *pParam,
const CCB_RSAClearKeyTypeDef *pRSAClearPrivateKey,
CCB_WrappingKeyTypeDef *pWrappingKey,
CCB_RSAKeyBlobTypeDef *pWrappedPrivateKeyBlob)
|
/* Software RSA Wrap Private Key*/
HAL_CCB_RSA_SW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_rsa_param_t *p_in_param,
const hal_ccb_rsa_clear_key_t *p_in_rsa_clear_private_key,
const hal_ccb_wrapping_sw_key_context_t *p_wrapping_key_context,
const uint32_t *p_in_wrapped_user_key,
hal_ccb_rsa_key_blob_t *p_out_wrapped_private_key_blob)
/* Hardware RSA Wrap Private Key*/
HAL_CCB_RSA_HW_WrapPrivateKey(hal_ccb_handle_t *hccb,
const hal_ccb_rsa_param_t *p_in_param,
const hal_ccb_rsa_clear_key_t *p_in_rsa_clear_private_key,
hal_ccb_wrapping_hw_key_type_t wrapping_hw_key_type,
hal_ccb_rsa_key_blob_t *p_out_wrapped_private_key_blob)
|
Example Usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Software RSA Wrap Private Key */
CCB_RSAParamTypeDef RSAparam;
CCB_RSAClearKeyTypeDef RSAKey;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_RSAKeyBlobTypeDef RSAKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_RSA_WrapPrivateKey(&hccb, &RSAparam, &RSAKey, &wrappedKeyConf, &RSAKeyBlob);
|
/* Software RSA Wrap Private Key */
hal_ccb_rsa_param_t RSAparam;
hal_ccb_rsa_clear_key_t RSAKey;
hal_ccb_wrapping_sw_key_context_t wrappedKeyConf;
hal_ccb_rsa_key_blob_t RSAKeyBlob;
hal_ccb_handle_t hccb;
uint32_t Wrapped_key_Buffer[8] = {0};
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_RSA_SW_WrapPrivateKey(&hccb, &RSAparam, &RSAKey, &wrappedKeyConf, Wrapped_key_Buffer, &RSAKeyBlob);
|
/* Hardware RSA Wrap Private Key */
CCB_RSAParamTypeDef RSAparam;
CCB_RSAClearKeyTypeDef RSAKey;
CCB_WrappingKeyTypeDef wrappedKeyConf;
CCB_RSAKeyBlobTypeDef RSAKeyBlob;
CCB_HandleTypeDef hccb;
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_HW;
HAL_CCB_RSA_WrapPrivateKey(&hccb, &RSAparam, &RSAKey, &wrappedKeyConf, &RSAKeyBlob);
|
/* Hardware RSA Wrap Private Key */
hal_ccb_rsa_param_t RSAparam;
hal_ccb_rsa_clear_key_t RSAKey;
hal_ccb_rsa_key_blob_t RSAKeyBlob;
hal_ccb_handle_t hccb;
HAL_CCB_RSA_HW_WrapPrivateKey(&hccb, &RSAparam, &RSAKey, HAL_CCB_KEY_HW, &RSAKeyBlob);
|
Key changes
In HAL2 the
Wrapped_key_Bufferis passed directly as an argument to the software RSA wrap private key function, instead of being included in the wrapping key configuration structure and a new argumentwrapping_hw_key_typeis added to the hardware RSA wrap private key function to specify which hardware wrapping key must be used.For more details refer to HAL CCB wrapping key type definition.